//
//  TopCollectionViewCell.m
//  WXMovie
//
//  Created by mac106 on 16/4/1.
//  Copyright © 2016年 无限互联. All rights reserved.
//

#import "TopCollectionViewCell.h"

#define  width 80

@implementation TopCollectionViewCell


- (instancetype)init {
    
    self = [super init];
    if (self) {
        //self.frame = CGRectMake(0, 0, width, 100);
        self.size = CGSizeMake(width, 100);
        _imaView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, width, 78)];
        [self addSubview:_imaView];
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 58, width, 18)];
        [_imaView addSubview:_titleLabel];
        _starView = [[UIView alloc] initWithFrame:CGRectMake(0, 80, width, 16)];
        [self addSubview:_starView];
        
    }
    
    return self;
    
}

- (void)setModel:(TopModel *)model {
    
    _model = model;
    self.titleLabel.text = _model.title;
    self.titleLabel.tintColor = [UIColor whiteColor];
    
    [self.imaView sd_setImageWithURL:[NSURL URLWithString:_model.images]];
    
    _star = [[StarViewCode alloc] initWithHeight:16];
    
     NSLog(@"%@",NSStringFromCGRect( _star.bounds));
    //_star.frame = _starView.bounds;
   // NSLog(@"%@",NSStringFromCGRect(_star.frame));
    [_starView addSubview:_star];
    
    [self.star changeStarViewWidthWithRating:_model.rating];
}


@end
